<?php
/**
 * 验证码
 *
 * @package     controller
 * @author      Akon(番茄红了) <aultoale@gmail.com>
 * @copyright   Copyright (c) 2008 (http://www.imeelee.com)
 * @license     http://www.gnu.org/licenses/gpl.html     GPL 3
 */
class CaptchaController extends Ext_Controller_Action
{

    /**
     * index
     */
    public function indexAction()
    {
        $this->view->title = '图形验证码';
        if ($this->request->isPost()) {
            $input = $this->request->getPost('input');
            if (EGP_Captcha::getInstance()->isValid($input)) {
                echo '<h1><font color=green>输入正确！</font></h1>';
            } else {
                echo '<h1><font color=red>输入错误！</font></h1>';
            }
        }
    }

    /**
     * 显示
     */
    public function displayAction()
    {
        EGP_Captcha::factory(
            $this->config->captcha->driver,
            $this->config->captcha->options
        )->generate();
        $this->view = null;
    }

}